﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using Umi.Web.Metadatas.ServiceStruct.http;

namespace Umi.Web.Abstraction.Services
{
    /// <summary>
    /// http 服务
    /// </summary>
    public interface IHttpService
    {
        /// <summary>
        /// Get请求
        /// </summary>
        /// <param name="url">url</param>
        /// <param name="param">参数</param>
        /// <param name="header">头部</param>
        /// <returns></returns>
        Task<HttpResult> Get(string url, IDictionary<string, string> param, IDictionary<string, string> header);

        /// <summary>
        /// Post Form表单
        /// </summary>
        /// <param name="url"></param>
        /// <param name="param"></param>
        /// <param name="header"></param>
        /// <returns></returns>
        Task<HttpResult> PostForForm(string url, IDictionary<string, string> param, IDictionary<string, string> header);

        /// <summary>
        /// Post Body
        /// </summary>
        /// <param name="url"></param>
        /// <param name="body"></param>
        /// <param name="header"></param>
        /// <returns></returns>
        Task<HttpResult> PostForBody(string url, string body, IDictionary<string, string> header);

        /// <summary>
        /// Post Stream
        /// </summary>
        /// <param name="url"></param>
        /// <param name="body"></param>
        /// <param name="header"></param>
        /// <returns></returns>
        Task<HttpResult> PostForStream(string url, Stream body, IDictionary<string, string> header);

        /// <summary>
        /// Post MutiPart
        /// </summary>
        /// <param name="url"></param>
        /// <param name="param"></param>
        /// <param name="header"></param>
        /// <param name="files"></param>
        /// <returns></returns>
        Task<HttpResult> PostForMutiPart(string url, IDictionary<string, string> param, IDictionary<string, Stream> files, IDictionary<string, string> header);

        /// <summary>
        /// Post Form表单
        /// </summary>
        /// <param name="url"></param>
        /// <param name="param"></param>
        /// <param name="header"></param>
        /// <returns></returns>
        Task<HttpResult> PutForForm(string url, IDictionary<string, string> param, IDictionary<string, string> header);

        /// <summary>
        /// Post Body
        /// </summary>
        /// <param name="url"></param>
        /// <param name="body"></param>
        /// <param name="header"></param>
        /// <returns></returns>
        Task<HttpResult> PutForBody(string url, string body, IDictionary<string, string> header);

        /// <summary>
        /// Post Stream
        /// </summary>
        /// <param name="url"></param>
        /// <param name="body"></param>
        /// <param name="header"></param>
        /// <returns></returns>
        Task<HttpResult> PutForStream(string url, Stream body, IDictionary<string, string> header);

        /// <summary>
        /// Post MutiPart
        /// </summary>
        /// <param name="url"></param>
        /// <param name="param"></param>
        /// <param name="header"></param>
        /// <param name="files"></param>
        /// <returns></returns>
        Task<HttpResult> PutForMutiPart(string url, IDictionary<string, string> param, IDictionary<string, Stream> files, IDictionary<string, string> header);
        /// <summary>
        /// Post Form表单
        /// </summary>
        /// <param name="url"></param>
        /// <param name="param"></param>
        /// <param name="header"></param>
        /// <returns></returns>
        Task<HttpResult> PatchForForm(string url, IDictionary<string, string> param, IDictionary<string, string> header);

        /// <summary>
        /// Post Body
        /// </summary>
        /// <param name="url"></param>
        /// <param name="body"></param>
        /// <param name="header"></param>
        /// <returns></returns>
        Task<HttpResult> PatchForBody(string url, string body, IDictionary<string, string> header);

        /// <summary>
        /// Post Stream
        /// </summary>
        /// <param name="url"></param>
        /// <param name="body"></param>
        /// <param name="header"></param>
        /// <returns></returns>
        Task<HttpResult> PatchForStream(string url, Stream body, IDictionary<string, string> header);

        /// <summary>
        /// Post MutiPart
        /// </summary>
        /// <param name="url"></param>
        /// <param name="param"></param>
        /// <param name="header"></param>
        /// <param name="files"></param>
        /// <returns></returns>
        Task<HttpResult> PatchForMutiPart(string url, IDictionary<string, string> param, IDictionary<string, Stream> files, IDictionary<string, string> header);

        /// <summary>
        /// Delete请求
        /// </summary>
        /// <param name="url">url</param>
        /// <param name="param">参数</param>
        /// <param name="header">头部</param>
        /// <returns></returns>
        Task<HttpResult> Delete(string url, IDictionary<string, string> param, IDictionary<string, string> header);

        /// <summary>
        /// Header 请求
        /// </summary>
        /// <param name="url">url</param>
        /// <param name="param">参数</param>
        /// <param name="header">头部</param>
        /// <returns></returns>
        Task<HttpResult> Header(string url, IDictionary<string, string> param, IDictionary<string, string> header);
    }
}
